home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 22
/
CU Amiga Magazine's Super CD-ROM 22 (1998)(EMAP Images)(GB)[!][issue 1998-05].iso
/
PowerPC
/
Programming
/
vbcc
/
readme.vbcc
< prev
next >
Wrap
Text File
|
1998-02-18
|
19KB
|
640 lines
vbcc - portable ANSI C compiler (c) in 1995-98 by Volker Barthelmann
INTRODUCTION
vbcc is a free portable and retargetable ANSI C compiler.
This archive contains the compiler, preprocessor, assembler, linker,
frontend, message browser, startup codes, C-libraries, amiga.lib
replacements as well as several other tools (mostly with complete
source) for 68k as well as PPC.
This gives you a complete system that allows to develop programs in
ANSI C as well as Amiga-specific programs (provided you obtain the
OS-includes) running on 68k or PowerUp-boards.
All major parts of this distribution (including compiler, preprocessor,
libraries etc.) have been compiled/assembled with this system and
apart from the OS-includes everything is included to rebuilt vbcc,
the libraries and many of the other programs.
Note that the programs in this archive all run on the 68k even when
generating PPC-code. There is another archive which contains compilers
that run on the PPC.
FEATURES
vbcc..
- comes with source
- is free
- is portable and retargetable
- comes with a global optimizer that can e.g. do global common
subexpression elimination, constant propagation, function inlining
and several other optimizations (but is not yet finished and may
have some bugs)
- should be ANSI compliant
- can generate code that runs on a plain 68000 CPU
- can generate code optimized for 020/030, 040 or 060
- can generate code that uses the 68881/2, 68040/060 FPUs directly
and comes with appropriate math-libraries
- can generate code that runs on PowerUp-boards
- generates standard Amiga-68k-objects or PPC-ELF-objects
- does not need too much memory
- comes with a message browser
- comes with a config program
- offers a lot of error/warning messages that can be turned on/off
separately
REQUIREMENTS
To use vbcc you need:
- an Amiga with OS 2.0 or higher
- enough RAM (it is possible to translate small programs with 1MB, but
for larger programs much more will be needed)
Stuff that is not needed, but may be very useful:
- harddisk
- editor
- make, touch etc.
- the Amiga OS-includes (they can be found on certain CDs)
- pipe-command (to use the message browser)
Also you should know how to use the shell and you should know ANSI C
(if you need a book I recommend (like everyone) "The C Programming
Language, Second Edition, ANSI C" by Kernighan and Ritchie).
LEGAL
Note that this distribution contains several programs, libraries etc.
that are from different authors and are under different legal status.
So always read the corresponding doc/guide-file to find out under
what conditions a certain file may be used, distributed etc.
For the most part you can assume that you may use everything for
non-commercial purposes and may distribute the unchanged archive
in whole.
Changing any parts from this archive, distributing parts of it or
using it commercially might be legal for certain parts, but illegal
for others, so read all docs carefully before doing any of the above.
This archive contains code written by (this list may be incomplete):
Volker Barthelmann, Frank Wille, Thorsten Schaaps, Dennis Ritchie,
Matthias Fleischer, Gunther Nikl, Mike Schwartz, Kasper Graversen,
Johnny Tevessen
However, if you have any comments/problems etc. with anything, please
do not bother them, but write to me (volker@vb.franken.de) first.
Exceptions are the parts by Kasper Graversen.
INSTALLATION/TUTORIAL
[Names of directories, binaries or assigns have changed since earlier
versions as have config-files. So users of earlier versions should
read this again and do a complete re-install to avoid problems.]
The first step (which you probably already did) is to extract the
entire archive (take care to preserve the file attributes).
The distributed programs are for the most part only usable from a shell.
To use vbcc the following steps are necessary:
1. Assign vbccm68k: to the subdirectory vbcc/machines/amiga68k,
vbccppc: to the subdirectory vbcc/machines/amigappc and
vbcc: to vbccm68k:
2. Assign vlibm68k: to vbccm68k:lib and
vlibppc: to vbccppc:lib.
3. Assign vincludem68k: to vbccm68k:include and
vincludeppc: to vbccppc:include.
If you have the OS-includes you can either add the path to this
assign, e.g.
assign vincludem68k: vbccm68k:include myhd:os-includes
assign vincludeppc: vbccppc:include myhd:os-includes
or you can modify the vc.config (see below).
If you want to use ixemul.lib assign ixinclude: to the directory
containing the ixemul-includes.
4. Add vbccm68k://bin, vbccm68k:bin and vbccppc:bin to your path.
5. set the stack to a reasonable value (perhaps some 10k).
If you use vbcc frequently it is probably a good idea to add those
commands to your user-startup, shell-startup or similar.
However if you just want to try it out the sample script init_vbcc in
the subdirectory machines/amiga68k does all this for you.
You have to cd in its directory and start it from there, e.g.:
cd myhd:vbcc/machines/amiga68k
init_vbcc
Now you should be able to use vbcc. E.g. if you want to compile and
link the program hello.c you can type
vc hello.c
This will compile and link the file hello.c and create the executable
a.out in the current directory.
vc hello.c -o hello
will do the same, but the created executable will be called hello.
vc -c t1.c t2.c
will compile t1.c and t2.c without linking, creating the object files
t1.o and t2.o.
vc t1.o t2.o -o tt
will link them together and create the executable tt.
If your program uses floating point add -lmieee to the commandline
to link with the math-library, e.g.:
vc calc.c -o calc -lmieee
There is also an extra.lib which includes a few functions that are
no standard ANSI functions but some people seem to regard them as
standard functions. If you use one of these add -lextra to the
commandline and read:
vbcc/machines/amiga68k/doc/extralib.doc
For further information read the files:
vbcc/doc/vbcc.doc
vbcc/doc/vc.doc
vbcc/doc/vbccm68k.doc
vbcc/machines/amiga68k/doc/vclib.doc
PPC-SUPPORT
If you want to generate PPC-code, all you have to do is to add +ppc
to your command-line.
vc +ppc hello.c -o hello
will create the ELF-executable called hello. To execute it, type
ppcrun hello
If a PPC-program expects arguments attach them:
ppcrun hello 1 2 "test 3"
Options specific to the 68k can of course not be used for PPC. See
doc/vbccppc.doc and machines/amigappc/doc/* for further information.
CAUTION: Note that if you write programs using AmigaOS-functions you
have to specify -amiga-align! You might want to add it to
vbcc:ppc if you usually use AmigaOS-functions.
Note that PPC-support should be considered beta and there is room
for many improvements.
CONFIGURATION
The frontend searches for a file vc.config in ENV: and vbcc: to read
preferences. The provided sample vc.config should be usable and does
not have to be changed but you can add something to suit your personal
preferences - read
vbcc/doc/vc.doc
to find out more.
If you have the OS-includes and do not want to add them to the vinclude:
assign mentioned above you can also modify the vc.config file:
Add -I<full_path> directly after the two occurences of -Ivinclude*: in
the sample vc.config, e.g.:
-pp=vcpp -Ivincludem68k: -Imyhd:os-include -D__STDC__=1 %s %s %s
-ppv=vcpp -Ivincludem68k: -Imyhd/os-include -D__STDC__=1 %s %s %s
MESSAGE BROWSER
If you start the message browser with
run vbrowse
it will open a window with a listview gadget. If you have a pipe
command installed you can now invoke vc via tovbr, e.g.
tovbr vc hello.c
and any output from vc will be displayed in the window of vbrowse
rather than in the shell. It might be convenient to make an alias like
alias vb tovbr vc
so that invoking vb will automatically display the output in the browser.
If there is an error/warning-message in the browser you can invoke a
configurable command by double-clicking on the message.
Double-clicking on the quoted line will invoke GoldEd (if you have it
installed) by default, load the file that caused the error and the cursor
will be placed on this line in the default configuration. If you use
another editor or want to change this behaviour have a look at
vbcc/machines/amiga68k/doc/vbrowse.doc.
Double-clicking on the error-line (the one below the quoted line) will
invoke the command showerr that will open the VBCCMessages.guide and
display a more detailed description of the error (if there is one in
the guide - there are not yet descriptions for all messages).
Read vbcc/machines/amiga68k/vbrowse.doc for further information.
CONTENTS
This archive contains (among others) the following files and directories:
vbcc/
The main directory. The source files for the compiler and the
builtin preprocessor by Thorsten Schaaps are here.
vbcc/doc/
Host independant documentation for the compiler is in this dir.
vbcc/doc/History
Changes in since earlier versions of the compiler.
vbcc/doc/vbcc.doc
Documentation for the target-independant part of the compiler.
vbcc/doc/errors.doc
A list of all error/warning-messages from the compiler -
sometimes with more detailed descriptions.
vbcc/doc/vbccm68k.doc
Documentation for the 68k code generator.
vbcc/doc/vbccppc.doc
Documentation for the PPC code generator.
vbcc/doc/vbcci386.doc
Documentation for the i386 code generator.
vbcc/doc/vc.doc
Documentation for the compiler-frontend.
vbcc/doc/vcpp.doc
Some short comments regarding the preprocessor from the
lcc-distribution. Read the copyright-notice.
vbcc/doc/building.doc
Documentation on building vbcc.
vbcc/vcpp/
The source for the external preprocessor by Dennis Ritchie.
vbcc/bin/
The directory containing binaries of preprocessor, compiler and
frontend. Additional binaries may be in machines/xyz/bin/.
vbcc/bin/vbccm68k
The native C compiler for m68k.
vbcc/bin/vbccppc
The C cross-compiler for PPC. Running on m68k.
vbcc/bin/vbccm68k_ppc
The C cross-compiler for m68k. Running on PPC. (optional)
vbcc/bin/vbccppc_ppc
The native C compiler for PPC. (optional)
vbcc/bin/vc
The compiler-frontend.
vbcc/bin/vcpp
The preprocessor from the lcc-distribution (by Dennis Ritchie).
vbcc/machines/amiga68k/
Everything that is specific to the Amiga68k is in this directory.
vbcc/machines/amiga68k/doc/
This contains documentation for the Amiga68k specific parts.
vbcc/machines/amiga68k/doc/extralib.doc
Documentation for extra.lib.
vbcc/machines/amiga68k/doc/PhxAss.guide
Documentation for the assembler by Frank Wille.
vbcc/machines/amiga68k/doc/PhxLnk.guide
Documentation for the linker by Frank Wille.
vbcc/machines/amiga68k/doc/VBCCMessages.guide
The vbcc/doc/errors.doc in Amigaguide-format (done by Walter
Doerwald).
vbcc/machines/amiga68k/doc/vclib.doc
Documentation for the Amiga-C-library.
vbcc/machines/amiga68k/doc/ixemul.doc
Documentation on using the ixemul.library.
vbcc/machines/amiga68k/doc/vbrowse.doc
Documentation on the message browser and several connected tools.
vbcc/machines/amiga68k/doc/fd2lib.doc
Documentation for fd2lib.
vbcc/machines/amiga68k/doc/minstart.doc
Documentation for minstart.o.
vbcc/machines/amiga68k/doc/alib.doc
Documentation for alib by Mike Schwartz.
vbcc/machines/amiga68k/init_vbcc
A sample script to do the necessary assigns etc. to use vbcc.
vbcc/machines/amiga68k/include
This directory contains the standard-ANSI-includes for vc.lib.
vbcc/machines/amiga68k/bin/
This directory contains all Amiga-specific executables.
vbcc/machines/amiga68k/bin/PhxAss
The assembler by Frank Wille.
vbcc/machines/amiga68k/bin/PhxLnk
The linker by Frank Wille.
vbcc/machines/amiga68k/bin/vbrowse
vbcc/machines/amiga68k/bin/vsend
vbcc/machines/amiga68k/bin/tovbr
vbcc/machines/amiga68k/bin/showerr
The message browser and some tools.
vbcc/machines/amiga68k/bin/vconfig
A user interface to edit the vc.config.
vbcc/machines/amiga68k/bin/fd2lib
fd2lib generates stubs for shared libraries and must be used to
rebuilt amiga.lib or if you want to use any custom shared-library.
vbcc/machines/amiga68k/bin/alib
Used to create link-libraries.
vbcc/machines/amiga68k/lib/
This directory contains the link-libraries and startup-codes.
vbcc/machines/amiga68k/lib/startup.o
The standard startup-code for vc.lib.
vbcc/machines/amiga68k/lib/vc.lib
The standard C-library.
vbcc/machines/amiga68k/lib/vcs.lib
The small data C-library.
vbcc/machines/amiga68k/lib/mieee.lib
Math-library that uses the MathIeee-libraries.
vbcc/machines/amiga68k/lib/m881.lib
Math-library that uses FPU-instructions of the 68881/2.
vbcc/machines/amiga68k/lib/m040.lib
Math-library that uses FPU-instructions that do not have to be
emulated on a 68040 and the Motorola emulation routines
otherwise.
vbcc/machines/amiga68k/lib/m040o.lib
Math-library that uses FPU-instructions that do not have to be
emulated on a 68040 and the MathIeee*.library functions
otherwise.
vbcc/machines/amiga68k/lib/crt0.o
Startup-code for using ixemul.library with large data model.
vbcc/machines/amiga68k/lib/bcrt0.o
Startup-code for using ixemul.library with small data model.
vbcc/machines/amiga68k/lib/ixemul.lib
Stub library for using ixemul.library with large data model.
vbcc/machines/amiga68k/lib/ixemuls.lib
Stub library for using ixemul.library with small data model.
vbcc/machines/amiga68k/lib/amiga.lib
Replacement for the standard amiga.lib.
vbcc/machines/amiga68k/lib/amigas.lib
Small data replacement for the standard amiga.lib.
vbcc/machines/amiga68k/lib/minstart.o
Small startup-code for small programs that do not use functions
from the C-library.
vbcc/machines/amiga68k/lib/extra.lib
Very small library containing a few functions some people want.
vbcc/machines/amiga68k/lib/extras.lib
Small data version of the above.
vbcc/machines/amigappc/
Everything that is specific to the AmigaPPC is in this directory.
vbcc/machines/amigappc/doc/
This contains documentation for the AmigaPPC specific parts.
vbcc/machines/amigppc/doc/extralib.doc
Documentation for libextra.a.
vbcc/machines/amigappc/doc/pasm.doc
Documentation for the assembler by Frank Wille.
vbcc/machines/amigappc/doc/vclib.doc
Documentation for the Amiga-C-library for PPC.
vbcc/machines/amigappc/doc/fd2libPPC.doc
Documentation for fd2libPPC.
vbcc/machines/amigappc/include
This directory contains the standard-ANSI-includes for libvc.a.
vbcc/machines/amigappc/bin/
This directory contains AmigaPPC-specific executables.
vbcc/machines/amigappc/bin/pasm
The assembler by Frank Wille running on 68k.
vbcc/machines/amigappc/bin/pasm_ppc
The assembler by Frank Wille running on PPC. (optional)
vbcc/machines/amigappc/bin/ppcrun
Program used to start PPC-ELF-executables.
vbcc/machines/amigappc/bin/fd2libPPC
fd2lib generates stubs for shared libraries and must be used to
rebuilt libvc.a or if you want to use any custom shared-library.
vbcc/machines/amigappc/bin/ppc-amigaos-ld
The GNU linker for ELF-objects. See doc/COPYING.
vbcc/machines/amigappc/bin/ppc-amigaos-ar
The GNU archiver for ELF-objects. See doc/COPYING.
vbcc/machines/amigappc/lib/
This directory contains the link-libraries and startup-codes.
vbcc/machines/amigappc/lib/startup.o
The standard startup-code for libvc.a.
vbcc/machines/amigappc/lib/libvc.a
The standard C-library. See doc/vclib.doc.
vbcc/machines/amigappc/lib/libm.a
Math-library. See doc/vclib.doc.
vbcc/machines/amigappc/lib/libamiga.a
Replacement for the standard amiga.lib.
vbcc/machines/amigappc/lib/libextra.a
Very small library containing a few functions some people want.
BUGREPORTS/COMMENTS
If you think vbcc generates bad code, throws enforcer hits, crashes,
seems to be not ANSI-compliant etc. and the problem is not mentioned
anywhere in this docs as known problem, please send a mail with your
system configuration, the vbcc version, the command line you used, the
source that caused the problem and a brief description of the problem to
volker@vb.franken.de
Also if you find problems with the includes, the libraries or you have
suggestions, dislikes etc. send me a mail.
Corrections, improvements etc. of the manuals are appreciated, too.
Volker Barthelmann volker@vb.franken.de
Kennedy-Ring 39
91301 Forchheim
Germany